<template>
  <div>
    <van-tabs @click="ass">
      <van-tab :name="item.id"  v-for="item in classify" :key="item.id" :title="item.title">
       
      </van-tab>
    </van-tabs>
  </div>
</template>

<script>
export default {
  data() {
    return {
      classify:[],
      photoList:[]
    };
  },

  methods: {
   async photo(){
    var {data:res}=await this.axios.get(`/api/getimgcategory`)
    console.log(res);
    if(res.status==0){
      this.classify=res.message
      this.classify.unshift( { title:'全部', id:0 })
      console.log(this.classify);
      
    }
    },
    async ass(id){
      var {data:res}= await this.axios.get(`/api/getimages/${id}`)
      console.log(res);
      if(res.status==0){
        this.photoList=res.message
      }
    }
  },

  created() {
    this.photo()
  }
};
</script>

<style lang='less' scoped>
</style>
